package com.takeoff.boot.controller;

import com.takeoff.boot.entity.FinancingDeclaration;
import com.takeoff.boot.service.FinancingDeclarationService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/declaration")
@AllArgsConstructor
public class FinancingDeclarationController{

    private final FinancingDeclarationService declarationService;

    @PostMapping("/saveUser")
    public String saveUser(@RequestBody FinancingDeclaration financingDeclaration){
        declarationService.save(financingDeclaration);
        return "SUCCESS";
    }

    @PostMapping("/detail")
    public FinancingDeclaration detail(@RequestBody FinancingDeclaration financingDeclaration) {
        FinancingDeclaration declaration = declarationService.getById(financingDeclaration.getId());
        return declaration;
    }
}
